<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title><%-book.bookname%></title>
	<link rel="stylesheet" href="/css/book.css">
	<link rel="stylesheet" href="/css/bookinfo.css">
	<link rel="stylesheet" href="/css/share.min.css">
	<style>
		.bookList h2 {
			width: 100%;
		}
	</style>
</head>

<body>
	<div class="header">
		<% if (typeof isLoggedIn !=='undefined' && isLoggedIn) { %>
			<!-- 如果用户已登录，显示用户名和注销链接 -->
			<span class="username">Welcome, <%= username %>!</span>
			<a id="loginout" href="/loginout">退出登录</a>
			<% } else { %>
				<!-- 如果用户未登录，显示登录链接 -->
				<a id="loginout" href="/login">用户登录</a>
				<% } %>

					<div class="navheader"></div>
					<div class="nav">
						<div class="navList">

							<div <% if(cid==0) { %> class="active link" <% } else { %> class="link" <% } %>><a
											href="/">首页</a></div>

							<% for(let i=0;i<cataorys.length;i++){ %>
								<div <% if(cid==(i+1)) { %> class="active link" <% } else { %> class="link" <% } %>><a
												href="/category/<%=cataorys[i].id%>/page/1">
												<%=cataorys[i].category%>
											</a></div>

								<%}%>

									<div class="search">
										<input type="text" id="search">
										<button class="searchBtn"><span class="icon"></span><span
												class="text">搜索</span></button>
									</div>
						</div>
					</div>
	</div>
	<div class="contentMain">
		<div class="content">
			<div class="bookList">
				<%-book.brief%>
			</div>
			<div class="erweima">
				<img src="/img/2043.png"><br /><img src="/img/2116.png" alt="">
			</div>
		</div>
	</div>
	<script>
		var isLoggedIn = <%- JSON.stringify(isLoggedIn) %>;
		console.log(isLoggedIn);
		var delDiv = document.querySelector("body > div.contentMain > div > div.bookList > div.open-message");
		delDiv.parentElement.removeChild(delDiv)


		delDiv = document.querySelector(".e-secret");
		delDiv.parentElement.removeChild(delDiv)
		delDiv = document.querySelector(".dltable~img");
		delDiv.parentElement.removeChild(delDiv)
		
		if (typeof isLoggedIn == 'undefined' || isLoggedIn == false) {
			delDiv = document.querySelector(".dltable");
			delDiv.parentElement.removeChild(delDiv)
		}

		delDiv = document.querySelector(".article-social");
		delDiv.parentElement.removeChild(delDiv)
		delDiv = document.querySelector("body > div.contentMain > div > div.bookList > table > tbody > tr:nth-child(3) > td > a:nth-child(2)")
		delDiv.parentElement.removeChild(delDiv)
		document.querySelector('body > div.contentMain > div > div.bookList > table  p').style.width = "30px"
	</script>

</body>

</html>